package org.jeecg.common.util;

import java.io.BufferedReader;
import java.io.InputStreamReader;

/**
 *  java调Python去重
 */
public class JavaCallPython {

    public static void main(String[] args) {
        try {
            String pythonPath = "";
            String [] command = {"python", pythonPath, "arg1", "arg2"};
            //启动进程
            ProcessBuilder pb = new ProcessBuilder(command);
            Process process = pb.start();
            //读取标准输出
            BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
            String line;
            while((line = reader.readLine()) != null){
                System.out.println(line);
            }

            BufferedReader errorReader = new BufferedReader(new InputStreamReader(process.getErrorStream()));
            while((line = errorReader.readLine()) != null){
                System.err.println(line);
            }

        } catch (Exception e){
            e.printStackTrace();
        }
    }
}
